package com.zmj.controller;

import com.zmj.common.Res;
import com.zmj.entity.User;
import com.zmj.mapper.UserMapper;
import com.zmj.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/mybatis")

public class MybatisController {
   @Autowired
    private UserMapper userMapper;
   @Autowired
    private UserService userService;

   @GetMapping("/list")
    public Res getList(){return new Res(1, "成功", userMapper.getUserByAccount("123"));}

    @PostMapping("/create")
    public Res createUser(@RequestBody User user) {
        return Res.create(1, "成功", userMapper.register(user));
    }
}
